CC = gcc
SRCS = $(wildcard *.c)
TARGET = test
OBJ_DIR = ./build

$(shell test -d $(OBJ_DIR) || mkdir $(OBJ_DIR))

OBJS = $(SRCS:.c=.o)

$(TARGET): $(addprefix $(OBJ_DIR)/,$(OBJS))
	$(CC) $^ -o $@

.PHONY:clean

clean:
	rm -f ./*.o ./build/*.o

$(addprefix $(OBJ_DIR)/,%o):%c
	$(CC) -c $< -o $@
